home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 2
/
SPACE - Library 2 - Volume 1.iso
/
music
/
55
/
applic
/
memlist.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1986-09-18
|
4KB
|
183 lines
*...
*...program to print alphabetical membership list
*...
USE MEMBERS INDEX MEMBERS
*...next statement turns off command line area
SET TALK OFF
DO WHILE T
ERASE
@5,0
TEXT
PROGRAM NOT FULLY ERROR TRAPPED!
If you choose to output the report to a file, make sure that
you have a disk in the drive you specify, and that it has
some room on it for the report!
ENDTEXT
@15,6
ACCEPT "Send list to Printer or File? (P/F) " TO CHOICE PICTURE "!"
IF CHOICE="P" OR CHOICE="F"
EXIT
ENDIF
ENDDO
SET PRINT ON
*...print message on screen
ERASE
IF CHOICE="P"
@5,0 SAY "Printing Membership List..."
ELSE
@5,0
ACCEPT "Print to what filespec? (ex. B:MEMLIST.TXT)" TO FNAME
SET PRINT TO &FNAME
ERASE
@5,0 SAY "Printing Membership List to "+FNAME
@0,0
ENDIF
SET CONSOLE OFF
*...set up page format and printer
*...line count is NET of top and bottom margins,
*...AND is net of heading lines
*...line count=58=66-top(3)-bottom(3)-headings(2)
SET TOPFORM
SET LINE COUNT TO 58
SET HEADING TO 'ALPHABETICAL LIST OF H.A.S.T.E. MEMBERS'+SPACE(23)+;
DTOC(DATE())+SPACE(3)+'PAGE '+STR(PAGENO(1),2)
SET PAGENO TO 1
*...set line 2 of heading to 80 characters of underline character
SET HEADING2 TO DUPCHAR(45,80)
SET FOOTER TO
*...width of report is two names across, 38 characters per name
*...this includes spaces between columns
WIDTH=38
GO TOP
*...start of major program loop
DO WHILE NOT EOF
*...start of each line is string of six blanks, providing left margin!
*...could just use SET LEFT MARGIN, but that would throw off centering
*...of heading/footer lines
STORE ' ' TO L1
STORE ' ' TO L2
STORE ' ' TO L3
STORE ' ' TO L4
*...inloop is counter for number of names across
STORE 1 TO INLOOP
DO WHILE INLOOP <= 2 AND NOT EOF
IF INIT<>' '
STORE TRIM(FIRST)+' '+INIT+'. '+TRIM(LAST) TO LINE1
IF INLOOP=1
L1=SUBSTR(L1+LINE1+SPACE(WIDTH),1,WIDTH)
ELSE
L1=L1+LINE1
ENDIF
ENDIF
IF FIRST=' ' AND LAST<>' '
STORE LAST TO LINE1
IF INLOOP=1
L1=SUBSTR(L1+LINE1+SPACE(WIDTH),1,WIDTH)
ELSE
L1=L1+LINE1
ENDIF
ENDIF
IF FIRST<>' ' AND INIT=' '
STORE TRIM(FIRST)+' '+LAST TO LINE1
IF INLOOP=1
L1=SUBSTR(L1+LINE1+SPACE(WIDTH),1,WIDTH)
ELSE
L1=L1+LINE1
ENDIF
ENDIF
IF ADDRESS1 <> ' ' AND INLOOP = 1
STORE ADDRESS1 TO LINE2
L2=SUBSTR(L2+LINE2+SPACE(WIDTH),1,WIDTH)
ENDIF
IF ADDRESS1 <> ' ' AND INLOOP = 2
STORE ADDRESS1 TO LINE2
IF L2<>' '
L2=L2+LINE2
ELSE
L2=SPACE(WIDTH)+LINE2
ENDIF
ENDIF
STORE ADDRESS2 TO LINE3
IF INLOOP=1
L3=SUBSTR(L3+LINE3+SPACE(WIDTH),1,WIDTH)
ELSE
L3=L3+LINE3
ENDIF
STORE TRIM(CITY)+', '+STATE+' '+ZIP TO LINE4
IF INLOOP=1
L4=SUBSTR(L4+LINE4+SPACE(WIDTH),1,WIDTH)
ELSE
L4=L4+LINE4
ENDIF
SKIP
INLOOP=INLOOP+1
ENDDO
*...actual code that prints list
IF PROW() = 1
?
ENDIF
*...if not enough room to fit a whole name & address at bottom of
*...page, do formfeed and continue on next page
IF PROW() >= 55
FORMFEED
ENDIF
? L1
IF LEN(L2) > 7
? L2
ENDIF
? L3
? L4
IF PROW() <= 57
?
ENDIF
ENDDO
EJECT
CLOSE ALL
SET PRINT OFF
SET PRINT TO 1
ERASE
SET HEADING TO
SET HEADING2 TO
SET FOOTER TO
SET PAGENO TO 1
SET CONSOLE ON
SET TALK ON
RETURN
ə